// app.ts
import * as util from './utils/util';
App({
	globalData: {

	},
	onLaunch() {
		// this.addStorageCount();
	},
	getHistoryData(){
		const history = wx.getStorageSync('history-data');
		return history?history:null;
	},
	addStorageCount() {
		const today = util.parseTime(new Date(), '{y}-{m}-{d}');
		const history = wx.getStorageSync('history-data');
		if(history){
			if(history[today]){
				history[today] = history[today] + 1;
			}else{
				history[today] = 1;
			}
			wx.setStorageSync('history-data',history);
		}else{
			const data:any = {};
			data[today] = 1;
			wx.setStorageSync('history-data',data);
		}
	},
})